package controllers;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import models.NewsModel;
import data.NewsData;

public class SitemapServlet extends HttpServlet{
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
		response.setContentType("text/xml");

		NewsData newsData = new NewsData();
		newsData.setLimit(50);
		ArrayList<NewsModel> lst_news = newsData.list();
	    
		request.setAttribute("lst_news", lst_news);
		try {
			request.getRequestDispatcher("/pages/sitemap.jsp").forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
